import { reqCategoryList, reqBannerList, reqFloorList } from '@/api'
//home的小仓库
const state = {
    //默认值别乱写，根据返回值的类型
    categoryList: [],
    bannerList: [],
    floorList: [],
};
const mutations = {
    CATEGORY(state, category) {
        state.categoryList = category;
    },
    BANNERLIST(state, bannerList) {
        state.bannerList = bannerList
    },
    FLOORLIST(state, floorList) {
        state.floorList = floorList
    }
};
const actions = {
    //获取三级分类数据
    async categoryList(context) {
        let result = await reqCategoryList();
        // console.log(result.data)
        context.commit('CATEGORY', result.data)
    },
    //获取轮播图的数据
    async getBannerList(context) {
        let result = await reqBannerList();
        context.commit('BANNERLIST', result.data);
    },
    //获取floor数据
    async getFloorList(context) {
        let result = await reqFloorList();
        context.commit('FLOORLIST', result.data);
    },
};
//计算属性
const getters = {};
export default {
    state,
    mutations,
    actions,
    getters
}